package com.hongkzh.www.conmon;

import java.text.DecimalFormat;

public class BigNumberFormat {
    public static DecimalFormat df   = new DecimalFormat("######0");
    public static DecimalFormat df2   = new DecimalFormat("######0.00");
    public static String  dataFormat(int d){
        StringBuffer sb=new StringBuffer();

        if(d<10000)
        {
            sb.append(d+"");
        }
       /* else if(d<10000.0)
        {
            sb.append(d/1000.0).append("千");
        }*/
        else if(d<10000000)
        {

                sb.append(df.format(d / 10000.0)).append("万");

        }
        else if(d<100000000.0)
        {
            sb.append(df.format(d/10000000)).append("千万");
        }
        else
        {
            sb.append(df.format(d/100000000)).append("亿");
        }
            return sb.toString();
    }
    public static String  dataFormatTenThousand(int d){
        StringBuffer sb=new StringBuffer();


            sb.append(df2.format(d / 10000.0));


        return sb.toString();
    }

    public static void main(String[] args) {
        System.out.println("http://sssss".indexOf("http"));
        System.out.println("/sssss".indexOf("http"));
        System.out.println(dataFormatTenThousand(100+5));
        System.out.println(dataFormat(100*10));
        System.out.println(dataFormat(100*100));
        System.out.println(dataFormatTenThousand(100*1000+9));
        System.out.println(dataFormat(100*10000+9));
        System.out.println(dataFormat(100*100000+9));
        System.out.println(dataFormat(100*10000000+9));
    }
}
